<!DOCTYPE html>
<html lang="en" xmlns:v-bind="http://www.w3.org/1999/xhtml"
      xmlns:v-on="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>库存管理列表</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-store, must-revalidate">
    <meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT">
    <meta http-equiv="expires" content="-1">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"
          name="viewport">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="shortcut icon" href="/dist/img/icon.png" type="image/x-icon">
    <!-- Bootstrap 3.3.6 -->
    <link rel="stylesheet" href="/dist/plugins/bootstrap/css/bootstrap.min.css">
    <!--字体-->
    <link rel="stylesheet" href="/dist/css/font-awesome.min.css">
    <!--图标-->
    <link rel="stylesheet" href="/dist/css/ionicons.min.css">
    <!--插件样式-->
    <link rel="stylesheet" href="/dist/plugins/select2/select2.min.css">
    <!--OA主样式-->
    <link rel="stylesheet" href="/dist/css/OA.min.css?t=39cd89cd">
    <link rel="stylesheet" href="/dist/css/skins/OA-skins.min.css?t=16f1e6f3">
    <style>
        .table>tbody>tr>td{
            height: 48px;
            max-height: 44px;
            overflow: hidden;
        }
        .lineOne {
            text-align: left;
        }

        .lineOne span {
            max-height: 20px;
            line-height: 20px;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 1;
            text-align: left;
        }
        .div-td-content-more {
            position: absolute;
            height: auto;
            z-index: 999;
            line-height: 20px;
            background-color: #d3e8fd;
            padding: 8px 6px;
            border: 1px solid #e8e8ea;
            display: none;
        }
        .div-td-content-more i {
            width: 15px;
            height: 12px;
            background: url("/dist/img/more-icon.png");
            position: absolute;
            left: 50px;
            top: -12px;
        }
    </style>
</head>
<body>
<section class="content" id="app">
    <div style="height: 25px;margin-bottom: 10px;">

        <button type="button"  class="btn oaBtn pull-right btn-sm"
                @click="gotoDetail('edit','1')"/>
        新增</button>
        <!-- /.box-tools -->
    </div>
    <div class="div-td-content-more"><i></i></div>
    <div class="box-body no-padding iframeH2" style="overflow: auto;" id="scrollDiv">
        <div id="progress" class="wyui-progress"></div>
        <table class="table table-hover table-bordered text-center table-striped">
            <thead>
            <tr>
                <!--<th style="width:20px;">-->
                <!--<input type="checkbox" id="checkAll" v-model="isCheckedAll"-->
                <!--v-if="pageType=='pay'"/>-->
                <!--</th>-->
                <td style="width: 50px">序号</td>
                <td>提货日期</td>
                <td>购车公司</td>
                <td>品牌</td>
                <td>库存地</td>
                <td>状态</td>
                <td>机型</td>
                <td>斗容</td>
                <td>铲斗类型</td>
                <td>序列号</td>
                <td>是否结清</td>
                <td>备注</td>
                <td>操作</td>
            </tr>
            </thead>
            <tbody id="tbList">
            <tr v-for="(item,i) in list">
                <td>{{i+1}}</td>
                <td>{{item.pickUpDate}}</td>
                <td>{{item.companyName}}</td>
                <td>{{item.brandName}}</td>
                <td>{{item.storeAddress}}</td>
                <td v-html="convertAuditFlagToName(item)">

                </td>
                <td>{{item.modelName}}</td>
                <td>2.0m3</td>
                <td>{{item.deviceTypeName}}</td>
                <td>{{item.sequence}}</td>
                <td>是</td>
                <td class="lineOne"><span>{{item.remark}}</span></td>
                <td>
                    <a href="javascript:void(0);"
                       @click="gotoDetail('look','1')">&nbsp;查看&nbsp;</a>
                </td>
            </tr>
            </tbody>
        </table>
        <div class="oa-pager text-center" style="margin-top: 5px;">
            共
            <span id="allCount"> 0 </span>条记录&nbsp;&nbsp;&nbsp;
            <span id="nowPage"> 1 </span>/<span id="allPage">1</span>&nbsp;&nbsp;&nbsp;
            <span class="oa-pager-button" id="first">首页</span>
            <span class="oa-pager-button" id="prev">上一页</span>
            <span class="oa-pager-button" id="next">下一页</span>
            <span class="oa-pager-button" id="last">尾页</span>
        </div>
    </div>
</section>
<!--JQ-->
<script src="https://file.ggxqce.com/web/jquery-2.2.3.min.js"></script>
<!--插件JS-->
<script src="https://file.ggxqce.com/web/bootstrap.min.js"></script>
<script src="https://file.ggxqce.com/web/vue.min.js"></script>
<script src="/dist/plugins/webuploader-0.1.5/webuploader.min.js"></script>
<script src="/dist/plugins/select2/select2.full.min.js"></script>
<!--框架已定义 JS-->
<script src="/dist/js/app_iframe.js?t=0b5caf39"></script>
<script type="text/javascript" src="/dist/plugins/lhgdialog/lhgdialog.min.js?self=true"></script>
<!--oa自定义  JS-->
<script src="/dist/js/oa.js?t=0c4d95a9"></script>
<script>
    $(function () {
        $("body").on("click", ".lineOne", function (e) {
            if ($(".div-td-content-more").is(":hidden")) {
                var text = $(this).text();
                if (text != "") {
                    text = "<i></i>" + text;
                    $(".div-td-content-more").html(text).css({
                        "width": $(this).outerWidth() + "px",
                        "left": $(this).offset().left,
                        "top": ($(this).offset().top + $(this).outerHeight()) + "px"
                    }).show();
                    e.stopPropagation();
                }
            } else {
                $(".div-td-content-more").hide();
            }
        });
        $("body").on("click", ".div-td-content-more", function (e) {
            e.stopPropagation();
        });
        $("body").on("click", function () {
            $(".div-td-content-more").hide();
        });
    });
</script>
<script type="text/javascript">
    function refresh() {
        $.wyui.page.getByPage();
    }
    var app = new Vue({
        el: '#app',
        data: {
            currentUser: getCurrentUser(),
            pageType: "apply",//apply:用款申请，pay:付款审核
            list: [],
            id: ''
        },

        methods: {
            convertAuditFlagToName: function (item) {
                switch (item.state) {
                    case "已出库":
                        return "<span style='color:red;'>"+item.state +"</span>";
                        break;
                    default :
                        return "<span>"+item.state +"</span>";
                        break;
                }
            },
            gotoDetail: function (pageType,id) {
                var H = $(window).height()-50;
                $.dialog({
                    content: 'url:detail.html?id='+id+ '&pageType=' + pageType,
                    title: '库存信息详情',
                    width: 1178,
                    height:580,
                    max: true,
                    min: true,
                    lock: true
                });
            },
        },
        mounted: function () {
            /* var that = this;
             this.pageType = $.wyui.page.urlParams.pageType;
             $.wyui.postMethod('/business/getBusinessListByPage.json',{userId: getCurrentUser().id}, function (data) {
             that.list = data.records;
             });
             */
        }
    });
    //分页
    $.wyui.page.dataUrl = server.ip + "/deviceSample/getDeviceSampleList.json"
    $.wyui.page.queryParams.pageType = $.wyui.page.urlParams.pageType;
    $.extend($.wyui.page.queryParams, app.searchParams);
    $.wyui.page.getByPage_callback = function (records) {
        app.list = records;
        document.getElementById("scrollDiv").scrollTop = 0;
    };
    $.wyui.page.getByPage_scroll_callback = function (list) {
        if (list.length < 30) {
            isLoad = false;
        } else {
            for (var i = 0; i < list.length; i++) {
                app.list.push(list[i]);
            }
            isLoad = true;
        }
    };
</script>
<script>
    /************************滚动加载******************************/
    var divscroll = document.getElementById('scrollDiv');

    function divScroll() {
        var wholeHeight = divscroll.scrollHeight;
        var scrollTop = divscroll.scrollTop;
        var divHeight = divscroll.clientHeight;
        console.log(scrollTop + divHeight, wholeHeight)
        if (scrollTop + divHeight >= wholeHeight - 2) {
//            alert('滚动到底部了！');
            if (isLoad) {
                isLoad = false;
                setTimeout($.wyui.page.getByPage("scroll"), 1000);

            }

            //这里写动态加载的逻辑，比如Ajax请求后端返回下一个页面的内容
        }

    }

    divscroll.onscroll = divScroll;
</script>
</body>
</html>